package com.atguigu.com.nio.nio_1_buffer;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;

/**
 * @Author: robert.song
 * @Date: Created in 2021/8/8
 */
public class ReadOnlyBuffer {
    public static void main(String args[]) throws IOException {
        ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
        InetSocketAddress inetSocketAddress = new InetSocketAddress(7000);
//        绑定端口到socket,并启动
        serverSocketChannel.socket().bind(inetSocketAddress);
//        创建buffer数组
        ByteBuffer[] byteBuffers = new ByteBuffer[2];
        byteBuffers[0] = ByteBuffer.allocate(5);
        byteBuffers[0] = ByteBuffer.allocate(5);
//        等待客户端连接（telnet）
        SocketChannel socketChannel = serverSocketChannel.accept();

    }
}
